using System;
using System.Diagnostics;

using Castle.DynamicProxy;

namespace Test.Interceptor
{
    public class DatabaseInterceptor : IInterceptor
    {
        public void Intercept(IInvocation invocation)
        {
            string msg = $"类型: {invocation.TargetType?.FullName}; 方法: {invocation.Method.Name}; 参数: {invocation.Arguments?.Length}";
            Debug.WriteLine($"{msg}; 执行前: {DateTime.Now}");
            invocation.Proceed();
            Debug.WriteLine($"{msg}; 执行后: {DateTime.Now}");
        }
    }
}
